﻿using RayDen.Library.Core.Primitives;

namespace RayDen.Library.Components.Color.Types
{
    public abstract class BaseColorType<TValue> : IColorType
    {
        public abstract TValue Value { get; }
        public IColorType Add(IColorType color)
        {
            return this.Add((BaseColorType<TValue>)color);
        }

        public IColorType Mul(IColorType color)
        {
            return this.Mul((BaseColorType<TValue>)color);
        }

        public IColorType Add(float f)
        {
            return this.AddFloat(f);
        }

        public IColorType Mul(float f)
        {
            return this.MulFloat(f);
        }

        public abstract float Sample(float lambda);
        public abstract bool IsBlack();
        public abstract RgbSpectrum ToXyz();
        public virtual float Filter()
        {
            throw new System.NotImplementedException();
        }

        public abstract void ToZero();
        public abstract void ToUnit();

        public abstract void TransformToRgb(out RgbSpectrum result);

        protected abstract BaseColorType<TValue> Add(BaseColorType<TValue> v);
        protected abstract BaseColorType<TValue> Mul(BaseColorType<TValue> v);
        protected abstract BaseColorType<TValue> AddFloat(float v);
        protected abstract BaseColorType<TValue> MulFloat(float v);



        public object Clone()
        {
            return this.Clone();
        }


        public abstract IColorType CloneValue();
    }
}